home *** CD-ROM | disk | FTP | other *** search
- Path: news.glo.be!usenet
- From: sclaeys@glo.be (Sven Claeys)
- Newsgroups: comp.lang.c
- Subject: Input into array of strings?
- Date: Thu, 07 Mar 1996 23:25:20 GMT
- Organization: Globe
- Message-ID: <4hnv1e$o7n@rhea.glo.be>
- NNTP-Posting-Host: ip139.z03.glo.be
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hi,
-
- I've got a some kind of problem reading into arrays of strings. I'm a
- bit rusty in C or C++, it's been a while, so please be patient with
- me.
-
- here we go:
-
- i've got a structure
-
- struct ImmoData
- {
- char code[3][5];
- ....
- }....;
-
- now i want to read data from a file with fgets(...) into this array.
-
- I've tried
- for (i=0; i<5; i++)
- fgets(code[i],....);
- or
- for (i=0; i<5; i++)
- fgets((char*) code[i], ...);
-
- but none of these seem to work. As i'm debugging the first code is
- read correct, but the second is appended to the first and is also read
- into the second, and so on.
-
- Could anyone help me with this strange phenomenon?
-
-
- Greetz.
- Sven.
-
-